package com.mycode.prototype05.model;

public class ConcretePrototype implements Prototype, Cloneable {

    // 成员变量
    private String attr;

    @Override
    public void setAttr(String attr) {
        this.attr = attr;
    }

    public String getAttr() {
        return this.attr;
    }

    // 克隆方法
    @Override
    public Prototype clone() {
        Object object = null;
        try {
            object = super.clone();
        } catch (CloneNotSupportedException e) {
            System.out.println("Not support cloneable");
        }
        // 创建原型类
        // Prototype prototype = new ConcretePrototype();
        // prototype.setAttr(this.attr);
        return (Prototype) object;
    }
}
